#include "CreditsState.h"
#include "../SGD Wrappers/CSGD_DirectInput.h"
#include "../SGD Wrappers/CSGD_Direct3D.h"
#include "Game.h"
#include "MainMenuState.h"
#include "BitmapFont.h"
#include <string>
using std::string;
#include "MenuManager.h"


CCreditsState* CCreditsState::GetInstance(void)
{
	static CCreditsState s_Instance;
	return &s_Instance;
}

CCreditsState::CCreditsState(void)
{
	m_pD3D = nullptr;
	m_pDI  = nullptr;
	m_pBF = nullptr;
	scroll = 0;
}


CCreditsState::~CCreditsState(void)
{
}

void CCreditsState::Enter( void )
{
	m_pD3D = CSGD_Direct3D::GetInstance();
	m_pDI  = CSGD_DirectInput::GetInstance();
	m_pBF = new CBitmapFont;
	m_pBF->Initialize();
}
void CCreditsState::Exit( void )
{
	delete m_pBF;
}
bool CCreditsState::Input(void)
{
	if( m_pDI->KeyPressed( DIK_ESCAPE ))
	{
		CMenuManager::GetInstance()->GoBack();
		CGame::GetInstance()->ChangeState( CMenuManager::GetInstance()->PlayBack() );
		//return false;
	}
	return true;
}
void CCreditsState::Update(float fElapsedTime)
{

}
void CCreditsState::Render(void)
{
	scroll += 0.01;
	if( scroll >= 350 )
		scroll = 350;
	string word;
		word = "ELEMENTAL STORM CREATED BY:";
	m_pBF->Print(word.c_str(), 0, 0+scroll, 0.6);
		word = "AFRO MONKEY";
	m_pBF->Print(word.c_str(), 500, 0+scroll, 0.5);
		word = "FULLSAIL UNIVERSITY";
	m_pBF->Print(word.c_str(), 0, 50+scroll, 0.5);
		word = "PRESS ENTER TO EXIT";
	m_pBF->Print(word.c_str(), 00, 100+scroll, 0.75);
}